package com.yxs.yapp.utils;

import android.view.View;
import android.widget.Toast;
import android.content.Context;

public class YView {

    // 私有构造方法，防止实例化
    private YView() {}

    //切换视图可见性
    public static void toggleVisibility(View view) {
        if (view != null) {
            int newVisibility = (view.getVisibility() == View.VISIBLE) ? View.GONE : View.VISIBLE;
            view.setVisibility(newVisibility);
        }
    }

    //显示短Toast
    public static void ShortToast(Context context, String message) {
        if (context != null) {
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    }

    //显示长Toast
    public static void LongToast(Context context, String message) {
        if (context != null) {
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
        }
    }
}
